<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Coverage Report</title>
<link title="Style" type="text/css" rel="stylesheet" href="css/main.css"/>
<script type="text/javascript" src="js/popup.js"></script>
</head>
<body>
<h5>Coverage Report - org.sakaiproject.entitybus.rest.EntityBatchHandler</h5>
<div class="separator">&nbsp;</div>
<table class="report">
<thead><tr>  <td class="heading">Classes in this File</td>  <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Line Coverage</a></td>  <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Branch Coverage</a></td>  <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Complexity</a></td></tr></thead>
  <tr><td><a href="org.sakaiproject.entitybus.rest.EntityBatchHandler.html">EntityBatchHandler</a></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">68%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:68px"><span class="text">206/301</span></div></div></td></tr></table></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">52%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:51px"><span class="text">96/186</span></div></div></td></tr></table></td><td class="value"><span class="hidden">0.0;</span>0</td></tr>
  <tr><td><a href="org.sakaiproject.entitybus.rest.EntityBatchHandler.html">EntityBatchHandler$ResponseBase</a></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">100%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:100px"><span class="text">6/6</span></div></div></td></tr></table></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">N/A</a></td><td class="percentgraph"><div class="percentgraph"><div class="na" style="width:100px"><span class="text"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">N/A</a></span></div></div></td></tr></table></td><td class="value"><span class="hidden">0.0;</span>0</td></tr>
  <tr><td><a href="org.sakaiproject.entitybus.rest.EntityBatchHandler.html">EntityBatchHandler$ResponseError</a></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">100%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:100px"><span class="text">7/7</span></div></div></td></tr></table></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">N/A</a></td><td class="percentgraph"><div class="percentgraph"><div class="na" style="width:100px"><span class="text"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">N/A</a></span></div></div></td></tr></table></td><td class="value"><span class="hidden">0.0;</span>0</td></tr>
  <tr><td><a href="org.sakaiproject.entitybus.rest.EntityBatchHandler.html">EntityBatchHandler$ResponseResult</a></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">59%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:59px"><span class="text">13/22</span></div></div></td></tr></table></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">100%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:100px"><span class="text">2/2</span></div></div></td></tr></table></td><td class="value"><span class="hidden">0.0;</span>0</td></tr>

</table>
<div class="separator">&nbsp;</div>
<table cellspacing="0" cellpadding="0" class="src">
<tr>  <td class="numLine">&nbsp;1</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;2</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * $Id: org.sakaiproject.entitybus.rest.EntityBatchHandler.html 12 2009-01-29 12:00:24Z azeckoski $</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;3</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * $URL: http://entitybus.googlecode.com/svn/maven/site/entitybus-rest/cobertura/org.sakaiproject.entitybus.rest.EntityBatchHandler.html $</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;4</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * EntityBatchHandler.java - entity-broker - Dec 18, 2008 11:40:39 AM - azeckoski</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;5</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> **************************************************************************</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;6</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * Copyright (c) 2008 Aaron Zeckoski</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;7</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * Licensed under the Apache License, Version 2.0</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;8</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * </span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;9</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * A copy of the Apache License has been included in this </span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;10</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * distribution and is available at: http://www.apache.org/licenses/LICENSE-2.0.txt</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;11</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> *</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;12</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * Aaron Zeckoski (azeckoski @ gmail.com) (aaronz @ vt.edu) (aaron @ caret.cam.ac.uk)</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;13</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;14</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;15</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">package</span> org.sakaiproject.entitybus.rest;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;16</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;17</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> java.io.IOException;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;18</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> java.util.HashMap;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;19</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> java.util.HashSet;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;20</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> java.util.Map;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;21</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> java.util.Map.Entry;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;22</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;23</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> javax.servlet.http.Cookie;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;24</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;25</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> javax.servlet.http.HttpServletResponse;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;26</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;27</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.apache.commons.logging.Log;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;28</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.apache.commons.logging.LogFactory;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;29</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.azeckoski.reflectutils.ArrayUtils;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;30</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.azeckoski.reflectutils.map.ArrayOrderedMap;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;31</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.EntityBrokerManager;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;32</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.EntityView;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;33</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.entityprovider.extension.Formats;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;34</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.exception.EntityException;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;35</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.providers.EntityRequestHandler;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;36</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.util.http.EntityHttpServletRequest;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;37</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.util.http.EntityHttpServletResponse;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;38</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.util.http.HttpClientWrapper;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;39</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.util.http.HttpRESTUtils;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;40</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.util.http.HttpResponse;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;41</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.util.http.URLData;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;42</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.util.http.HttpRESTUtils.Method;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;43</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">import</span> org.sakaiproject.entitybus.util.request.RequestUtils;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;44</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;45</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;46</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;47</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * This handles batch operations internally as much as possible,</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;48</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * the idea is to provide for a standard way to reduce huge numbers of calls down to 1 call to the server</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;49</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * which puts the data together into a single response</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;50</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * </span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;51</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> * @author Aaron Zeckoski (azeckoski @ gmail.com)</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;52</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment"> */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;53</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="keyword">public</span> <span class="keyword">class</span> EntityBatchHandler {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;54</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;55</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String HEADER_BATCH_STATUS = <span class="string">"batchStatus"</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;56</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String HEADER_BATCH_ERRORS = <span class="string">"batchErrors"</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;57</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String HEADER_BATCH_MAPPING = <span class="string">"batchMapping"</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;58</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String HEADER_BATCH_URLS = <span class="string">"batchURLs"</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;59</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String HEADER_BATCH_REFS = <span class="string">"batchRefs"</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;60</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String HEADER_BATCH_KEYS = <span class="string">"batchKeys"</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;61</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String HEADER_BATCH_METHOD = <span class="string">"batchMethod"</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;62</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String UNREFERENCED_PARAMS = <span class="string">"NoRefs"</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;63</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;64</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * This is the name of the parameter which is used to pass along the reference URLs to be batch processed</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;65</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;66</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String REFS_PARAM_NAME = <span class="string">"_refs"</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;67</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String UNIQUE_DATA_PREFIX = <span class="string">"X-XqReplaceQX-X-"</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;68</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> Log log = LogFactory.getLog(EntityBatchHandler.<span class="keyword">class</span>);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;69</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">static</span> String INTERNAL_SERVER_ERROR_STATUS_STRING = HttpServletResponse.SC_INTERNAL_SERVER_ERROR+<span class="string">""</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;70</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;71</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;72</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Empty constructor, must use setters to set the needed services</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;73</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;74</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;    <span class="keyword">public</span> EntityBatchHandler() { }</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;75</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;76</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;77</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Full constructor, use this to correctly construct this class,</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;78</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * note that after construction, the entityRequestHandler must be set also</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;79</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;80</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">public</span> EntityBatchHandler(EntityBrokerManager entityBrokerManager,</pre></td></tr>
<tr>  <td class="numLine">&nbsp;81</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            EntityEncodingManager entityEncodingManager) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;82</td>  <td class="nbHitsCovered">&nbsp;53</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">super</span>();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;83</td>  <td class="nbHitsCovered">&nbsp;53</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">this</span>.entityBrokerManager = entityBrokerManager;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;84</td>  <td class="nbHitsCovered">&nbsp;53</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">this</span>.entityEncodingManager = entityEncodingManager;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;85</td>  <td class="nbHitsCovered">&nbsp;53</td>  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;86</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;87</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> EntityBrokerManager entityBrokerManager;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;88</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">public</span> <span class="keyword">void</span> setEntityBrokerManager(EntityBrokerManager entityBrokerManager) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;89</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        <span class="keyword">this</span>.entityBrokerManager = entityBrokerManager;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;90</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;    }</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;91</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;92</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> EntityEncodingManager entityEncodingManager;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;93</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">public</span> <span class="keyword">void</span> setEntityEncodingManager(EntityEncodingManager entityEncodingManager) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;94</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        <span class="keyword">this</span>.entityEncodingManager = entityEncodingManager;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;95</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;    }</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;96</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;97</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;98</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Can only set this after the class is constructed since it forms a circular dependency,</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;99</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * this is being set by the setter/constructor in the EntityHandlerImpl</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;100</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;101</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> EntityHandlerImpl entityRequestHandler;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;102</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">public</span> <span class="keyword">void</span> setEntityRequestHandler(EntityHandlerImpl entityRequestHandler) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;103</td>  <td class="nbHitsCovered">&nbsp;53</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">this</span>.entityRequestHandler = entityRequestHandler;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;104</td>  <td class="nbHitsCovered">&nbsp;53</td>  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;105</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;106</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">// allow the servlet name to be more flexible</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;107</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> String servletContext;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;108</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> String getServletContext() {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;109</td>  <td class="nbHitsUncovered"><a title="Line 109: Conditional coverage 50% (1/2).">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 109: Conditional coverage 50% (1/2).">        <span class="keyword">if</span> (<span class="keyword">this</span>.servletContext == <span class="keyword">null</span>) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;110</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            setServletContext(<span class="keyword">null</span>); <span class="comment">// set defaults</span></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;111</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;112</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">return</span> <span class="keyword">this</span>.servletContext;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;113</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;114</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;115</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">public</span> <span class="keyword">void</span> setServletContext(String servletContext) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;116</td>  <td class="nbHitsUncovered"><a title="Line 116: Conditional coverage 50% (1/2).">&nbsp;26</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 116: Conditional coverage 50% (1/2).">        <span class="keyword">if</span> (servletContext == <span class="keyword">null</span>) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;117</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            servletContext = RequestUtils.getServletContext(<span class="keyword">null</span>);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;118</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;119</td>  <td class="nbHitsCovered">&nbsp;26</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">this</span>.servletContext = servletContext;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;120</td>  <td class="nbHitsCovered">&nbsp;26</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">this</span>.servletBatch = servletContext + EntityRequestHandler.SLASH_BATCH;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;121</td>  <td class="nbHitsCovered">&nbsp;26</td>  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;122</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;123</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> String servletBatch;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;124</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> String getServletBatch() {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;125</td>  <td class="nbHitsUncovered"><a title="Line 125: Conditional coverage 50% (1/2).">&nbsp;20</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 125: Conditional coverage 50% (1/2).">        <span class="keyword">if</span> (<span class="keyword">this</span>.servletBatch == <span class="keyword">null</span>) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;126</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            setServletContext(<span class="keyword">null</span>); <span class="comment">// set defaults</span></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;127</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;128</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">return</span> <span class="keyword">this</span>.servletBatch;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;129</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;130</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;131</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;132</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Handle the batch operations encoded in this view and request</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;133</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param view the current view</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;134</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param req the current request</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;135</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param res the current response</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;136</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;137</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">public</span> <span class="keyword">void</span> handleBatch(EntityView view, HttpServletRequest req, HttpServletResponse res) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;138</td>  <td class="nbHitsUncovered"><a title="Line 138: Conditional coverage 50% (3/6) [each condition: 50%, 50%, 50%].">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 138: Conditional coverage 50% (3/6) [each condition: 50%, 50%, 50%].">        <span class="keyword">if</span> (view == <span class="keyword">null</span> || req == <span class="keyword">null</span> || res == <span class="keyword">null</span>) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;139</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">throw</span> <span class="keyword">new</span> IllegalArgumentException(<span class="string">"Could not process batch: invalid arguments, no args can be null (view="</span>+view+<span class="string">",req="</span>+req+<span class="string">",res="</span>+res+<span class="string">")"</span>);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;140</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;141</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;142</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// set up the servlet context if this is the first time</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;143</td>  <td class="nbHitsUncovered"><a title="Line 143: Conditional coverage 50% (1/2).">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 143: Conditional coverage 50% (1/2).">        <span class="keyword">if</span> (<span class="keyword">this</span>.servletContext == <span class="keyword">null</span>) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;144</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            setServletContext( RequestUtils.getServletContext(req) );</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;145</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;146</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;147</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// first find out which METHOD we are dealing with</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;148</td>  <td class="nbHitsUncovered"><a title="Line 148: Conditional coverage 50% (1/2).">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 148: Conditional coverage 50% (1/2).">        String reqMethod = req.getMethod() == <span class="keyword">null</span> ? EntityView.Method.GET.name() : req.getMethod().toUpperCase().trim();</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;149</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        Method method = HttpRESTUtils.makeMethodFromString(reqMethod);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;150</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;151</td>  <td class="nbHitsUncovered"><a title="Line 151: Conditional coverage 38% (3/8) [each condition: 100%, 50%, 0%, 0%].">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 151: Conditional coverage 38% (3/8) [each condition: 100%, 50%, 0%, 0%].">        <span class="keyword">if</span> (Method.GET.equals(method) </a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;152</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                || Method.POST.equals(method)</pre></td></tr>
<tr>  <td class="numLine">&nbsp;153</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                || Method.PUT.equals(method)</pre></td></tr>
<tr>  <td class="numLine">&nbsp;154</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                || Method.DELETE.equals(method)) {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;155</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// valid methods</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;156</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;            res.setHeader(HEADER_BATCH_METHOD, method.name());</pre></td></tr>
<tr>  <td class="numLine">&nbsp;157</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;158</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">throw</span> <span class="keyword">new</span> IllegalArgumentException(<span class="string">"Cannot batch "</span>+reqMethod+<span class="string">" request method, cannot continue processing request: "</span> + view);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;159</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;160</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;161</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// now get to handling stuff</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;162</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        String format = view.getFormat();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;163</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        String servletContext = getServletContext(); <span class="comment">// will be the servlet context (e.g. /direct)</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;164</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;165</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// validate the the refs param</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;166</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        String[] refs = getRefsOrFail(req);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;167</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;168</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// decode the params into a set of reference params</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;169</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        Map&lt;String, Map&lt;String, String[]&gt;&gt; referencedParams = extractReferenceParams(req, method, refs);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;170</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;171</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// loop through all references</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;172</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        HashSet&lt;String&gt; processedRefsAndURLs = <span class="keyword">new</span> HashSet&lt;String&gt;(); <span class="comment">// holds all refs which we processed in this batch</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;173</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        HashMap&lt;String, String&gt; dataMap = <span class="keyword">new</span> ArrayOrderedMap&lt;String, String&gt;(); <span class="comment">// the returned content data from each ref</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;174</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        Map&lt;String, ResponseBase&gt; results = <span class="keyword">new</span> ArrayOrderedMap&lt;String, ResponseBase&gt;(); <span class="comment">// the results of all valid refs</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;175</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">boolean</span> successOverall = <span class="keyword">false</span>; <span class="comment">// true if all ok or partial ok, false if exception occurs or all fail</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;176</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">boolean</span> failure = <span class="keyword">false</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;177</td>  <td class="nbHitsCovered"><a title="Line 177: Conditional coverage 100% (2/2).">&nbsp;32</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 177: Conditional coverage 100% (2/2).">        <span class="keyword">for</span> (<span class="keyword">int</span> i = 0; i &lt; refs.length; i++) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;178</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            String refKey = <span class="string">"ref"</span> + i;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;179</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            String reference = refs[i];</pre></td></tr>
<tr>  <td class="numLine">&nbsp;180</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// validate the reference is not blank</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;181</td>  <td class="nbHitsUncovered"><a title="Line 181: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">&nbsp;20</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 181: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">            <span class="keyword">if</span> (reference == <span class="keyword">null</span> || <span class="string">""</span>.equals(reference)) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;182</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                <span class="keyword">continue</span>; <span class="comment">// skip</span></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;183</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;184</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// skip refs that are already done, we do not process twice unless it is a POST</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;185</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// NOTE: this duplicate check happens again slightly down below so change both at once</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;186</td>  <td class="nbHitsUncovered"><a title="Line 186: Conditional coverage 75% (3/4) [each condition: 100%, 50%].">&nbsp;20</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 186: Conditional coverage 75% (3/4) [each condition: 100%, 50%].">            <span class="keyword">if</span> (! Method.POST.equals(method) </a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;187</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    &amp;&amp; processedRefsAndURLs.contains(reference)) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;188</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                log.warn(<span class="string">"Found a duplicate reference, this will not be processed: "</span> + reference);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;189</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                <span class="keyword">continue</span>; <span class="comment">// skip for GET/DELETE/PUT</span></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;190</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;191</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// fix anything that does not start with a slash or http</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;192</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            String entityURL = reference;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;193</td>  <td class="nbHitsUncovered"><a title="Line 193: Conditional coverage 25% (1/4) [each condition: 50%, 0%].">&nbsp;20</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 193: Conditional coverage 25% (1/4) [each condition: 50%, 0%].">            <span class="keyword">if</span> (! reference.startsWith(<span class="string">"/"</span>) </a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;194</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    &amp;&amp; ! reference.startsWith(<span class="string">"http://"</span>)) {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;195</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                <span class="comment">// assume this is an EB entity url without the slash</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;196</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                entityURL = servletContext + EntityView.SEPARATOR + reference;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;197</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;198</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// make sure no one tries to batch a batch</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;199</td>  <td class="nbHitsUncovered"><a title="Line 199: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">&nbsp;20</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 199: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">            <span class="keyword">if</span> (reference.startsWith(EntityRequestHandler.SLASH_BATCH)</a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;200</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    || reference.startsWith( getServletBatch() )) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;201</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                <span class="keyword">throw</span> <span class="keyword">new</span> EntityException(<span class="string">"Failure processing batch request, "</span></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;202</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        + <span class="string">"batch reference ("</span>+reference+<span class="string">") ("</span>+entityURL+<span class="string">") appears to be another "</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;203</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        + <span class="string">"batch URL (contains "</span>+EntityRequestHandler.SLASH_BATCH+<span class="string">"), "</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;204</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        + <span class="string">"failure in batch request: "</span> + view,</pre></td></tr>
<tr>  <td class="numLine">&nbsp;205</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        EntityRequestHandler.SLASH_BATCH, </pre></td></tr>
<tr>  <td class="numLine">&nbsp;206</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        HttpServletResponse.SC_BAD_REQUEST);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;207</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;208</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;209</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// in case there are external ones we will reuse this httpclient</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;210</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            HttpClientWrapper clientWrapper = <span class="keyword">null</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;211</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;212</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// object will hold the results of this reference request</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;213</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            ResponseBase result = <span class="keyword">null</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;214</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;215</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// parse the entityURL, should hopefully not cause a failure</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;216</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            URLData ud = <span class="keyword">new</span> URLData(entityURL);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;217</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;218</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">/*</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;219</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">             * identify the EB direct operations - </span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;220</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">             * this allows us to strip extensions and cleanup direct URLs as needed,</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;221</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">             * possibly also handle these specially later on if desired,</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;222</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">             * only EB operations can be handled internally</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;223</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">             */</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;224</td>  <td class="nbHitsUncovered"><a title="Line 224: Conditional coverage 50% (1/2).">&nbsp;20</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 224: Conditional coverage 50% (1/2).">            <span class="keyword">if</span> ( servletContext.equals(ud.contextPath) ) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;225</td>  <td class="nbHitsUncovered"><a title="Line 225: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">&nbsp;20</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 225: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">                <span class="keyword">if</span> (ud.pathInfo == <span class="keyword">null</span> || <span class="string">""</span>.equals(ud.pathInfo)) {</a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;226</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    <span class="comment">// looks like this servlet only with no path and we do not process that</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;227</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    <span class="keyword">continue</span>;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;228</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;229</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;230</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;                <span class="keyword">boolean</span> success = <span class="keyword">false</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;231</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                <span class="keyword">try</span> {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;232</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    <span class="comment">// parse the entityURL to verify it</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;233</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;                    entityBrokerManager.parseReference(ud.pathInfo);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;234</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;                    success = <span class="keyword">true</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;235</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                } <span class="keyword">catch</span> (IllegalArgumentException e) {</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;236</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    String errorMessage = <span class="string">"Failure parsing direct entityURL ("</span>+entityURL+<span class="string">") from reference ("</span>+reference+<span class="string">") from path ("</span>+ud.pathInfo+<span class="string">"): "</span> + e.getMessage() + <span class="string">":"</span> + e.getCause();</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;237</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    log.warn(errorMessage);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;238</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    result = <span class="keyword">new</span> ResponseError(reference, entityURL, errorMessage);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;239</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;240</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;241</td>  <td class="nbHitsUncovered"><a title="Line 241: Conditional coverage 50% (1/2).">&nbsp;20</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 241: Conditional coverage 50% (1/2).">                <span class="keyword">if</span> (success) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;242</td>  <td class="nbHitsCovered"><a title="Line 242: Conditional coverage 100% (2/2).">&nbsp;20</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 242: Conditional coverage 100% (2/2).">                    <span class="keyword">if</span> (Method.GET.equals(method)) {</a></pre></td></tr>
<tr>  <td class="numLine">&nbsp;243</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        <span class="comment">// rebuild the entityURL with the correct extension in there for GET</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;244</td>  <td class="nbHitsCovered">&nbsp;17</td>  <td class="src"><pre class="src">&nbsp;                        StringBuilder sb = <span class="keyword">new</span> StringBuilder();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;245</td>  <td class="nbHitsCovered">&nbsp;17</td>  <td class="src"><pre class="src">&nbsp;                        sb.append( servletContext );</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;246</td>  <td class="nbHitsCovered">&nbsp;17</td>  <td class="src"><pre class="src">&nbsp;                        sb.append(ud.pathInfoNoExtension);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;247</td>  <td class="nbHitsCovered">&nbsp;17</td>  <td class="src"><pre class="src">&nbsp;                        sb.append(EntityView.PERIOD);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;248</td>  <td class="nbHitsCovered">&nbsp;17</td>  <td class="src"><pre class="src">&nbsp;                        sb.append(format);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;249</td>  <td class="nbHitsUncovered"><a title="Line 249: Conditional coverage 50% (1/2).">&nbsp;17</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 249: Conditional coverage 50% (1/2).">                        <span class="keyword">if</span> (ud.query.length() &gt; 0) {</a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;250</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                            <span class="comment">// add on the query string</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;251</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                            sb.append(<span class="string">'?'</span>);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;252</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                            sb.append(ud.query);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;253</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;254</td>  <td class="nbHitsCovered">&nbsp;17</td>  <td class="src"><pre class="src">&nbsp;                        entityURL = sb.toString();</pre></td></tr>
<tr>  <td class="numLine">&nbsp;255</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;256</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;257</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    <span class="comment">// skip URLs that are already done, we do not process twice unless it is a POST</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;258</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    <span class="comment">// NOTE: this duplicate check happens again slightly above so change both at once</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;259</td>  <td class="nbHitsUncovered"><a title="Line 259: Conditional coverage 75% (3/4) [each condition: 100%, 50%].">&nbsp;20</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 259: Conditional coverage 75% (3/4) [each condition: 100%, 50%].">                    <span class="keyword">if</span> (! Method.POST.equals(method) </a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;260</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                            &amp;&amp; processedRefsAndURLs.contains(entityURL)) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;261</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                        log.warn(<span class="string">"Found a duplicate entityURL, this will not be processed: "</span> + entityURL);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;262</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                        <span class="keyword">continue</span>; <span class="comment">// skip</span></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;263</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;264</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;265</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;                    result = generateInternalResult(refKey, reference, entityURL, req, res, method, referencedParams);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;266</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;267</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;268</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;269</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                <span class="comment">// non-EB URL so we have to fire it off using the HttpUtils</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;270</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;271</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                <span class="comment">// http utils requires full URLs</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;272</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                entityURL = makeFullExternalURL(req, entityURL);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;273</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;274</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                <span class="comment">// set the client wrapper with cookies so we can reuse it for efficiency</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;275</td>  <td class="nbHitsUncovered"><a title="Line 275: Conditional coverage 0% (0/2).">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 275: Conditional coverage 0% (0/2).">                <span class="keyword">if</span> (clientWrapper == <span class="keyword">null</span>) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;276</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    clientWrapper = HttpRESTUtils.makeReusableHttpClient(<span class="keyword">false</span>, 0, req.getCookies());</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;277</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;278</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                result = generateExternalResult(refKey, reference, entityURL, method, referencedParams, clientWrapper);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;279</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;280</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;281</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// special handling for null result (should really not happen unless there was a logic error)</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;282</td>  <td class="nbHitsUncovered"><a title="Line 282: Conditional coverage 50% (1/2).">&nbsp;20</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 282: Conditional coverage 50% (1/2).">            <span class="keyword">if</span> (result == <span class="keyword">null</span>) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;283</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                successOverall = <span class="keyword">false</span>;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;284</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                failure = <span class="keyword">true</span>;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;285</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                <span class="keyword">throw</span> <span class="keyword">new</span> IllegalStateException(<span class="string">"Somehow the result is null, this should never happen, fatal error"</span>);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;286</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;287</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;288</td>  <td class="nbHitsCovered"><a title="Line 288: Conditional coverage 100% (2/2).">&nbsp;20</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 288: Conditional coverage 100% (2/2).">            <span class="keyword">if</span> (result <span class="keyword">instanceof</span> ResponseError) {</a></pre></td></tr>
<tr>  <td class="numLine">&nbsp;289</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                <span class="comment">// looks like a failure occurred, keep going though</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;290</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                successOverall = <span class="keyword">false</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;291</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                failure = <span class="keyword">true</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;292</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;293</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                <span class="comment">// all ok, process data</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;294</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;                <span class="keyword">int</span> status = result.getStatus();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;295</td>  <td class="nbHitsUncovered"><a title="Line 295: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">&nbsp;19</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 295: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">                <span class="keyword">if</span> (status &gt;= 200 &amp;&amp; status &lt; 300) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;296</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;                    successOverall = <span class="keyword">true</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;297</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;298</td>  <td class="nbHitsUncovered"><a title="Line 298: Conditional coverage 50% (1/2).">&nbsp;19</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 298: Conditional coverage 50% (1/2).">                <span class="keyword">if</span> (status == HttpServletResponse.SC_NO_CONTENT) {</a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;299</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    <span class="comment">// no content to process</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;300</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    ((ResponseResult)result).content = <span class="keyword">null</span>;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;301</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    ((ResponseResult)result).data = <span class="keyword">null</span>;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;302</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;303</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    <span class="comment">// process the content and see if it matches the expected result, if not we have to dump it in escaped</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;304</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;                    String content = ((ResponseResult)result).content;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;305</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;                    String dataKey = checkContent(format, content, refKey, dataMap);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;306</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;                    ((ResponseResult)result).setDataKey(dataKey);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;307</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;308</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;309</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;310</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// store the processed ref and url so we do not do them again</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;311</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            processedRefsAndURLs.add(reference);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;312</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            processedRefsAndURLs.add(entityURL);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;313</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            results.put(refKey, result); <span class="comment">// use an artificial key</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;314</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;315</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;316</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// determine overall status</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;317</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">int</span> overallStatus = HttpServletResponse.SC_OK;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;318</td>  <td class="nbHitsUncovered"><a title="Line 318: Conditional coverage 75% (3/4) [each condition: 100%, 50%].">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 318: Conditional coverage 75% (3/4) [each condition: 100%, 50%].">        <span class="keyword">if</span> (failure == <span class="keyword">true</span> || successOverall == <span class="keyword">false</span>) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;319</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;            overallStatus = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;320</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;321</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;322</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// die if every ref was invalid</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;323</td>  <td class="nbHitsUncovered"><a title="Line 323: Conditional coverage 50% (1/2).">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 323: Conditional coverage 50% (1/2).">        <span class="keyword">if</span> (results.size() == 0) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;324</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">throw</span> <span class="keyword">new</span> EntityException(<span class="string">"Invalid request which resulted in no valid references to batch process, original _refs=("</span></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;325</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    +ArrayUtils.arrayToString(refs)+<span class="string">")"</span>, EntityRequestHandler.SLASH_BATCH, HttpServletResponse.SC_BAD_REQUEST);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;326</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;327</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;328</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// compile all the responses into encoded data</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;329</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        String overallData = entityEncodingManager.encodeData(results, format, <span class="string">"refs"</span>, <span class="keyword">null</span>);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;330</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// replace the data unique keys if there are any</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;331</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        overallData = reintegrateDataContent(format, dataMap, overallData);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;332</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;333</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// put response, headers, and code into the http response</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;334</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        applyOverallHeaders(res, results);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;335</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// put content into the response</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;336</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">try</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;337</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;            res.getWriter().write(overallData);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;338</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        } <span class="keyword">catch</span> (IOException e) {</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;339</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">throw</span> <span class="keyword">new</span> RuntimeException(<span class="string">"Unable to encode data for overall response: "</span> + e.getMessage(), e);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;340</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;341</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// set overall status code</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;342</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        res.setStatus(overallStatus);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;343</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;344</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;345</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;346</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * This will decode the set of params into a group of reference params based on the set of references</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;347</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param req the current request</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;348</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param method the current method</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;349</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param refs the array of references</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;350</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @return the map of reference params with unreferenced params under the {@value #UNREFERENCED_PARAMS} key</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;351</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * and everything else in ref# -&gt; params map</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;352</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;353</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    @SuppressWarnings(<span class="string">"unchecked"</span>)</pre></td></tr>
<tr>  <td class="numLine">&nbsp;354</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> Map&lt;String, Map&lt;String, String[]&gt;&gt; extractReferenceParams(</pre></td></tr>
<tr>  <td class="numLine">&nbsp;355</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            HttpServletRequest req, Method method, String[] refs) {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;356</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// Decode params into a reference map based on the refs for POST/PUT</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;357</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        ArrayOrderedMap&lt;String, Map&lt;String, String[]&gt;&gt; referencedParams = <span class="keyword">null</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;358</td>  <td class="nbHitsUncovered"><a title="Line 358: Conditional coverage 75% (3/4) [each condition: 100%, 50%].">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 358: Conditional coverage 75% (3/4) [each condition: 100%, 50%].">        <span class="keyword">if</span> (Method.POST.equals(method) || Method.PUT.equals(method) ) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;359</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;            referencedParams = <span class="keyword">new</span> ArrayOrderedMap&lt;String, Map&lt;String, String[]&gt;&gt;();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;360</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;            Map&lt;String, String[]&gt; params = req.getParameterMap();</pre></td></tr>
<tr>  <td class="numLine">&nbsp;361</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// create the maps to hold the params</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;362</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;            referencedParams.put(UNREFERENCED_PARAMS, <span class="keyword">new</span> ArrayOrderedMap&lt;String, String[]&gt;(params.size()));</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;363</td>  <td class="nbHitsCovered"><a title="Line 363: Conditional coverage 100% (2/2).">&nbsp;4</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 363: Conditional coverage 100% (2/2).">            <span class="keyword">for</span> (<span class="keyword">int</span> i = 0; i &lt; refs.length; i++) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;364</td>  <td class="nbHitsCovered">&nbsp;3</td>  <td class="src"><pre class="src">&nbsp;                String refKey = <span class="string">"ref"</span> + i + <span class="string">'.'</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;365</td>  <td class="nbHitsCovered">&nbsp;3</td>  <td class="src"><pre class="src">&nbsp;                referencedParams.put(refKey, <span class="keyword">new</span> ArrayOrderedMap&lt;String, String[]&gt;(params.size()));</pre></td></tr>
<tr>  <td class="numLine">&nbsp;366</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;367</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// put all request params into the map</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;368</td>  <td class="nbHitsCovered"><a title="Line 368: Conditional coverage 100% (2/2).">&nbsp;1</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 368: Conditional coverage 100% (2/2).">            <span class="keyword">for</span> (Entry&lt;String, String[]&gt; entry : params.entrySet()) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;369</td>  <td class="nbHitsCovered"><a title="Line 369: Conditional coverage 100% (2/2).">&nbsp;8</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 369: Conditional coverage 100% (2/2).">                <span class="keyword">if</span> (REFS_PARAM_NAME.equals(entry.getKey())) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;370</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                    <span class="keyword">continue</span>; <span class="comment">// skip over the refs param</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;371</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;372</td>  <td class="nbHitsCovered">&nbsp;7</td>  <td class="src"><pre class="src">&nbsp;                <span class="keyword">boolean</span> found = <span class="keyword">false</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;373</td>  <td class="nbHitsCovered"><a title="Line 373: Conditional coverage 100% (2/2).">&nbsp;7</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 373: Conditional coverage 100% (2/2).">                <span class="keyword">for</span> (String refKey : referencedParams.keySet()) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;374</td>  <td class="nbHitsCovered"><a title="Line 374: Conditional coverage 100% (2/2).">&nbsp;22</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 374: Conditional coverage 100% (2/2).">                    <span class="keyword">if</span> (entry.getKey().startsWith(refKey)) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;375</td>  <td class="nbHitsCovered">&nbsp;6</td>  <td class="src"><pre class="src">&nbsp;                        String key = entry.getKey();</pre></td></tr>
<tr>  <td class="numLine">&nbsp;376</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        <span class="comment">// fix key by removing the ref#. prefix</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;377</td>  <td class="nbHitsCovered">&nbsp;6</td>  <td class="src"><pre class="src">&nbsp;                        key = key.substring(refKey.length());</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;378</td>  <td class="nbHitsUncovered"><a title="Line 378: Conditional coverage 50% (1/2).">&nbsp;6</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 378: Conditional coverage 50% (1/2).">                        <span class="keyword">if</span> (key.length() == 0) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;379</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                            log.warn(<span class="string">"Skipping invalid reference param name ("</span>+entry.getKey()+<span class="string">"), "</span> +</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;380</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                                            <span class="string">"name must start with ref#. but MUST have the actual name of the param after that"</span>);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;381</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;382</td>  <td class="nbHitsCovered">&nbsp;6</td>  <td class="src"><pre class="src">&nbsp;                            referencedParams.get(refKey).put(key, entry.getValue());</pre></td></tr>
<tr>  <td class="numLine">&nbsp;383</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;384</td>  <td class="nbHitsCovered">&nbsp;6</td>  <td class="src"><pre class="src">&nbsp;                        found = <span class="keyword">true</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;385</td>  <td class="nbHitsCovered">&nbsp;6</td>  <td class="src"><pre class="src">&nbsp;                        <span class="keyword">break</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;386</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;387</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;388</td>  <td class="nbHitsCovered"><a title="Line 388: Conditional coverage 100% (2/2).">&nbsp;7</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 388: Conditional coverage 100% (2/2).">                <span class="keyword">if</span> (!found) {</a></pre></td></tr>
<tr>  <td class="numLine">&nbsp;389</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    <span class="comment">// put the values into the unreferenced params portion of the map</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;390</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                    referencedParams.get(UNREFERENCED_PARAMS).put(entry.getKey(), entry.getValue());</pre></td></tr>
<tr>  <td class="numLine">&nbsp;391</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;392</td>  <td class="nbHitsCovered">&nbsp;7</td>  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;393</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;394</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">return</span> referencedParams;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;395</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;396</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;397</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;398</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Apply the headers to the batched response,</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;399</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * these headers are applied to all responses</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;400</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param res the response to apply headers to</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;401</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param results the results of the requests</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;402</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;403</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> <span class="keyword">void</span> applyOverallHeaders(HttpServletResponse res, Map&lt;String, ResponseBase&gt; results) {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;404</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// set overall headers - batchRefs, batchKeys, batchStatus, batchErrors, batchInvalidRefs</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;405</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">int</span> count = 0;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;406</td>  <td class="nbHitsCovered"><a title="Line 406: Conditional coverage 100% (2/2).">&nbsp;12</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 406: Conditional coverage 100% (2/2).">        <span class="keyword">for</span> (Entry&lt;String, ResponseBase&gt; entry : results.entrySet()) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;407</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            String refKey = entry.getKey();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;408</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            ResponseBase refResp = entry.getValue();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;409</td>  <td class="nbHitsCovered"><a title="Line 409: Conditional coverage 100% (2/2).">&nbsp;20</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 409: Conditional coverage 100% (2/2).">            <span class="keyword">if</span> (count == 0) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;410</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;                res.setHeader(HEADER_BATCH_KEYS, refKey);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;411</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;                res.setHeader(HEADER_BATCH_REFS, refResp.getReference());</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;412</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;                res.setHeader(HEADER_BATCH_URLS, refResp.getEntityURL());</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;413</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;                res.setHeader(HEADER_BATCH_MAPPING, refKey + <span class="string">"="</span> + refResp.getReference());</pre></td></tr>
<tr>  <td class="numLine">&nbsp;414</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;415</td>  <td class="nbHitsCovered">&nbsp;8</td>  <td class="src"><pre class="src">&nbsp;                res.addHeader(HEADER_BATCH_KEYS, refKey);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;416</td>  <td class="nbHitsCovered">&nbsp;8</td>  <td class="src"><pre class="src">&nbsp;                res.addHeader(HEADER_BATCH_REFS, refResp.getReference());</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;417</td>  <td class="nbHitsCovered">&nbsp;8</td>  <td class="src"><pre class="src">&nbsp;                res.addHeader(HEADER_BATCH_URLS, refResp.getEntityURL());</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;418</td>  <td class="nbHitsCovered">&nbsp;8</td>  <td class="src"><pre class="src">&nbsp;                res.addHeader(HEADER_BATCH_MAPPING, refKey + <span class="string">"="</span> + refResp.getReference());</pre></td></tr>
<tr>  <td class="numLine">&nbsp;419</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;420</td>  <td class="nbHitsCovered"><a title="Line 420: Conditional coverage 100% (2/2).">&nbsp;20</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 420: Conditional coverage 100% (2/2).">            <span class="keyword">if</span> (refResp.isFailure()) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;421</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                res.addHeader(HEADER_BATCH_ERRORS, refKey);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;422</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                res.addHeader(HEADER_BATCH_STATUS, INTERNAL_SERVER_ERROR_STATUS_STRING);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;423</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;424</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;                <span class="keyword">int</span> status = ((ResponseResult) refResp).getStatus();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;425</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;                res.addHeader(HEADER_BATCH_STATUS, Integer.toString(status));</pre></td></tr>
<tr>  <td class="numLine">&nbsp;426</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;427</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            count++;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;428</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;429</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;430</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;431</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;432</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;433</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Processing internal (EB) requests</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;434</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @return the result from the request (may be an error)</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;435</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;436</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> ResponseBase generateInternalResult(String refKey, String reference, String entityURL, HttpServletRequest req, </pre></td></tr>
<tr>  <td class="numLine">&nbsp;437</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            HttpServletResponse res, Method method, Map&lt;String, Map&lt;String, String[]&gt;&gt; referencedParams) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;438</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;        ResponseBase result = <span class="keyword">null</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;439</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;        ResponseError error = <span class="keyword">null</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;440</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;441</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">/* WARNING: This is important to understand why this was done as is</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;442</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * First of all, forget the servlet forwarding, it is hopeless.</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;443</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * Why you ask? This is why, tomcat 5 has issues with calling forward using a set of custom</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;444</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * httpservelet* objects, it REQUIRES objects that are tomcat objects and attempts to use and</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;445</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * even cast to those objects. This causes 2 failures:</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;446</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * 1) tomcat attempts to access specific attributes from the request which are not there in</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;447</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * other request objects, thus it skips over processing the request entirely... without marking it as failed...</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;448</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * 2) tomcat attempts to cast the response object to a tomcat object after most of the processing</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;449</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * is complete and causes a ClassCastException which blows up everything</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;450</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * </span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;451</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * The alternatives are using httpclient for everything (maybe not a bad plan)</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;452</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * or calling the entity request handler directly, this has its own issues in that</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;453</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * it actually causes problems with redirection and requires injecting things</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;454</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * which depend on each other</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;455</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * </span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;456</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * One last note on this, this all works fine in Jetty... tomcat fail</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;457</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * Fun times for all</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;458</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;459</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;460</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;        EntityHttpServletRequest entityRequest = <span class="keyword">new</span> EntityHttpServletRequest(req, entityURL);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;461</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;        entityRequest.setContextPath(<span class="string">""</span>);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;462</td>  <td class="nbHitsUncovered"><a title="Line 462: Conditional coverage 75% (3/4) [each condition: 100%, 50%].">&nbsp;20</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 462: Conditional coverage 75% (3/4) [each condition: 100%, 50%].">        <span class="keyword">if</span> (Method.POST.equals(method) || Method.PUT.equals(method) ) {</a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;463</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// set only the unreferenced and correct referenced params for this request</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;464</td>  <td class="nbHitsCovered">&nbsp;3</td>  <td class="src"><pre class="src">&nbsp;            entityRequest.clearParameters(); <span class="comment">// also clears REFS_PARAM_NAME</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;465</td>  <td class="nbHitsCovered">&nbsp;3</td>  <td class="src"><pre class="src">&nbsp;            entityRequest.setParameters( referencedParams.get(UNREFERENCED_PARAMS) );</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;466</td>  <td class="nbHitsCovered">&nbsp;3</td>  <td class="src"><pre class="src">&nbsp;            String key = refKey + <span class="string">'.'</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;467</td>  <td class="nbHitsUncovered"><a title="Line 467: Conditional coverage 50% (1/2).">&nbsp;3</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 467: Conditional coverage 50% (1/2).">            <span class="keyword">if</span> (referencedParams.containsKey(key)) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;468</td>  <td class="nbHitsCovered">&nbsp;3</td>  <td class="src"><pre class="src">&nbsp;                entityRequest.setParameters( referencedParams.get(key) );</pre></td></tr>
<tr>  <td class="numLine">&nbsp;469</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;470</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// set the params from the query itself again</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;471</td>  <td class="nbHitsCovered">&nbsp;3</td>  <td class="src"><pre class="src">&nbsp;            entityRequest.setParameters( entityRequest.pathQueryParams );</pre></td></tr>
<tr>  <td class="numLine">&nbsp;472</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">//log.info("All request params: " + entityRequest.getStringParameters());</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;473</td>  <td class="nbHitsCovered">&nbsp;3</td>  <td class="src"><pre class="src">&nbsp;        } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;474</td>  <td class="nbHitsCovered">&nbsp;17</td>  <td class="src"><pre class="src">&nbsp;            entityRequest.removeParameter(REFS_PARAM_NAME); <span class="comment">// make sure this is not passed along</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;475</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;476</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;        entityRequest.setUseRealDispatcher(<span class="keyword">false</span>); <span class="comment">// we do not want to actually have the container handle forwarding</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;477</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;        EntityHttpServletResponse entityResponse = <span class="keyword">new</span> EntityHttpServletResponse(res);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;478</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;479</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">boolean</span> redirected = <span class="keyword">false</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;480</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">do</span> {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;481</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="keyword">try</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;482</td>  <td class="nbHitsCovered">&nbsp;21</td>  <td class="src"><pre class="src">&nbsp;                entityRequestHandler.handleEntityAccess(entityRequest, entityResponse, <span class="keyword">null</span>);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;483</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;                redirected = <span class="keyword">false</span>; <span class="comment">// assume no redirect</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;484</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;            } <span class="keyword">catch</span> (Exception e) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;485</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                String errorMessage = <span class="string">"Failure attempting to process reference ("</span>+reference+<span class="string">") for url ("</span>+entityURL+<span class="string">"): "</span> + e.getMessage() + <span class="string">":"</span> + e;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;486</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                log.warn(errorMessage, e);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;487</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                error = <span class="keyword">new</span> ResponseError(reference, entityURL, errorMessage);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;488</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                <span class="keyword">break</span>; <span class="comment">// take us out if there is a failure</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;489</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;490</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// Must handle all redirects manually despite the annoyance - this is really crappy but oh well</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;491</td>  <td class="nbHitsCovered"><a title="Line 491: Conditional coverage 100% (2/2).">&nbsp;20</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 491: Conditional coverage 100% (2/2).">            <span class="keyword">if</span> (entityResponse.isRedirected()) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;492</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                String redirectURL = entityResponse.getRedirectedUrl();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;493</td>  <td class="nbHitsUncovered"><a title="Line 493: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">&nbsp;1</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 493: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">                <span class="keyword">if</span> (redirectURL == <span class="keyword">null</span> || redirectURL.length() == 0) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;494</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    <span class="keyword">throw</span> <span class="keyword">new</span> EntityException(<span class="string">"Failed to find redirect URL when redirect was indicated by status ("</span>+entityResponse.getStatus()+<span class="string">") for reference ("</span>+reference+<span class="string">")"</span>, reference);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;495</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;496</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                entityURL = redirectURL;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;497</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                <span class="comment">// check that the redirect is not external</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;498</td>  <td class="nbHitsUncovered"><a title="Line 498: Conditional coverage 50% (1/2).">&nbsp;1</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 498: Conditional coverage 50% (1/2).">                <span class="keyword">if</span> ( entityURL.startsWith(servletContext) ) {</a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;499</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    <span class="comment">// internal</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;500</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                    entityRequest.setPathString(redirectURL);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;501</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                    entityResponse.reset();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;502</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;                    redirected = <span class="keyword">true</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;503</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;504</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    <span class="comment">// TODO find a way to handle an external URL here</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;505</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    redirected = <span class="keyword">false</span>;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;506</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;507</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;508</td>  <td class="nbHitsCovered"><a title="Line 508: Conditional coverage 100% (2/2).">&nbsp;20</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 508: Conditional coverage 100% (2/2).">        } <span class="keyword">while</span> (redirected);</a></pre></td></tr>
<tr>  <td class="numLine">&nbsp;509</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;510</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">/** OLD CODE which can't work in tomcat 5</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;511</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">        // setup the request and response objects to do the reference request</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;512</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">        RequestDispatcher dispatcher = req.getRequestDispatcher(entityURL); // should only be the relative path from this webapp</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;513</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">        // the request needs to get the full url or path though</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;514</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">        EntityHttpServletRequest entityRequest = new EntityHttpServletRequest(req, req.getContextPath() + entityURL);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;515</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">        entityRequest.setContextPath("");</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;516</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">        entityRequest.removeParameter(REFS_PARAM_NAME); // make sure this is not passed along</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;517</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">        EntityHttpServletResponse entityResponse = new EntityHttpServletResponse(res);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;518</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;519</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">        // fire off the URLs to the server and get back responses</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;520</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">        try {</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;521</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">            // need to forward instead of include to get headers back</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;522</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">            dispatcher.forward(entityRequest, entityResponse);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;523</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">        } catch (Exception e) {</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;524</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">            String errorMessage = "Failure attempting to process reference ("+reference+"): " + e.getMessage() + ":" + e;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;525</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">            log.warn(errorMessage, e);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;526</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">            error = new ResponseError(reference, entityURL, errorMessage);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;527</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">        }</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;528</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         **/</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;529</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;530</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// create the result object to encode and place into the final response</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;531</td>  <td class="nbHitsCovered"><a title="Line 531: Conditional coverage 100% (2/2).">&nbsp;20</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 531: Conditional coverage 100% (2/2).">        <span class="keyword">if</span> (error == <span class="keyword">null</span>) {</a></pre></td></tr>
<tr>  <td class="numLine">&nbsp;532</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// all ok, create the result for the response object</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;533</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// all cookies go into the main response</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;534</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;            Cookie[] cookies = entityResponse.getCookies();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;535</td>  <td class="nbHitsUncovered"><a title="Line 535: Conditional coverage 50% (1/2).">&nbsp;19</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 535: Conditional coverage 50% (1/2).">            <span class="keyword">for</span> (Cookie cookie : cookies) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;536</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                res.addCookie(cookie);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;537</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;538</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// status codes are compiled</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;539</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">int</span> status = entityResponse.getStatus();</pre></td></tr>
<tr>  <td class="numLine">&nbsp;540</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// create the result (with raw content)</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;541</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;            result = <span class="keyword">new</span> ResponseResult(reference, entityURL, status, entityResponse.getHeaders(), entityResponse.getContentAsString());</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;542</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;        } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;543</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;            result = error;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;544</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;545</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">return</span> result;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;546</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;547</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;548</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;549</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Processing external (non-EB) requests</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;550</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @return the result from the request (may be an error)</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;551</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;552</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> ResponseBase generateExternalResult(String refKey, String reference, String entityURL, Method method, </pre></td></tr>
<tr>  <td class="numLine">&nbsp;553</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            Map&lt;String, Map&lt;String, String[]&gt;&gt; referencedParams, HttpClientWrapper clientWrapper) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;554</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        ResponseBase result = <span class="keyword">null</span>;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;555</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        ResponseError error = <span class="keyword">null</span>;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;556</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;557</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        <span class="keyword">boolean</span> guaranteeSSL = <span class="keyword">false</span>;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;558</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// TODO allow enabling SSL?</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;559</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        Map&lt;String, String&gt; params = <span class="keyword">null</span>;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;560</td>  <td class="nbHitsUncovered"><a title="Line 560: Conditional coverage 0% (0/4) [each condition: 0%, 0%].">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 560: Conditional coverage 0% (0/4) [each condition: 0%, 0%].">        <span class="keyword">if</span> (referencedParams != <span class="keyword">null</span> &amp;&amp; ! referencedParams.isEmpty()) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;561</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            params = <span class="keyword">new</span> ArrayOrderedMap&lt;String, String&gt;(referencedParams.size());</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;562</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// put all unreferenced params in</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;563</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            Map&lt;String, String[]&gt; urp = referencedParams.get(UNREFERENCED_PARAMS);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;564</td>  <td class="nbHitsUncovered"><a title="Line 564: Conditional coverage 0% (0/2).">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 564: Conditional coverage 0% (0/2).">            <span class="keyword">for</span> (Entry&lt;String, String[]&gt; entry : urp.entrySet()) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;565</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                String name = entry.getKey();</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;566</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                String value;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;567</td>  <td class="nbHitsUncovered"><a title="Line 567: Conditional coverage 0% (0/4) [each condition: 0%, 0%].">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 567: Conditional coverage 0% (0/4) [each condition: 0%, 0%].">                <span class="keyword">if</span> (entry.getValue() == <span class="keyword">null</span> || entry.getValue().length == 0) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;568</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    value = <span class="string">""</span>;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;569</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;570</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    value = entry.getValue()[0];</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;571</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;572</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                params.put(name, value);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;573</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            }</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;574</td>  <td class="nbHitsUncovered"><a title="Line 574: Conditional coverage 0% (0/4) [each condition: 0%, 0%].">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 574: Conditional coverage 0% (0/4) [each condition: 0%, 0%].">            <span class="keyword">if</span> (Method.POST.equals(method) || Method.PUT.equals(method) ) {</a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;575</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                <span class="comment">// put all referenced params in for this key</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;576</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                String key = refKey + <span class="string">'.'</span>;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;577</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                Map&lt;String, String[]&gt; rp = referencedParams.get(key);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;578</td>  <td class="nbHitsUncovered"><a title="Line 578: Conditional coverage 0% (0/2).">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 578: Conditional coverage 0% (0/2).">                <span class="keyword">if</span> (rp != <span class="keyword">null</span>) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;579</td>  <td class="nbHitsUncovered"><a title="Line 579: Conditional coverage 0% (0/2).">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 579: Conditional coverage 0% (0/2).">                    <span class="keyword">for</span> (Entry&lt;String, String[]&gt; entry : rp.entrySet()) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;580</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                        String name = entry.getKey();</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;581</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        String value;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;582</td>  <td class="nbHitsUncovered"><a title="Line 582: Conditional coverage 0% (0/4) [each condition: 0%, 0%].">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 582: Conditional coverage 0% (0/4) [each condition: 0%, 0%].">                        <span class="keyword">if</span> (entry.getValue() == <span class="keyword">null</span> || entry.getValue().length == 0) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;583</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                            value = <span class="string">""</span>;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;584</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;585</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                            value = entry.getValue()[0];</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;586</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;587</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                        params.put(name, value);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;588</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                    }</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;589</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;590</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;591</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;592</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// fire off the request and hope it does not die horribly</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;593</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        HttpResponse httpResponse = <span class="keyword">null</span>;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;594</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">try</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;595</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            httpResponse = HttpRESTUtils.fireRequest(clientWrapper, </span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;596</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    entityURL, </pre></td></tr>
<tr>  <td class="numLine">&nbsp;597</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    method,</pre></td></tr>
<tr>  <td class="numLine">&nbsp;598</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    params, <span class="keyword">null</span>, guaranteeSSL);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;599</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        } <span class="keyword">catch</span> (RuntimeException e) {</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;600</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            String errorMessage = <span class="string">"Failure attempting to process external URL ("</span>+entityURL+<span class="string">") from reference ("</span>+reference+<span class="string">"): "</span> + e.getMessage() + <span class="string">":"</span> + e;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;601</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            log.warn(errorMessage); <span class="comment">//, e); // remove ,e to reduce error here</span></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;602</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            error = <span class="keyword">new</span> ResponseError(reference, entityURL, errorMessage);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;603</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        }</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;604</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;605</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// create the result object to encode and place into the final response</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;606</td>  <td class="nbHitsUncovered"><a title="Line 606: Conditional coverage 0% (0/2).">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 606: Conditional coverage 0% (0/2).">        <span class="keyword">if</span> (error == <span class="keyword">null</span>) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;607</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            result = <span class="keyword">new</span> ResponseResult(reference, entityURL, httpResponse.getResponseCode(), </span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;608</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                    httpResponse.getResponseHeaders(), httpResponse.getResponseBody());</pre></td></tr>
<tr>  <td class="numLine">&nbsp;609</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        } <span class="keyword">else</span> {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;610</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            result = error;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;611</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;612</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        <span class="keyword">return</span> result;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;613</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;614</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;615</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;616</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Creates a full URL so that the request can be sent</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;617</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param req the request</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;618</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param entityURL the partial URL (e.g. /thing/blah)</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;619</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @return a full URL (e.g. http://server/thing/blah)</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;620</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;621</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> String makeFullExternalURL(HttpServletRequest req, String entityURL) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;622</td>  <td class="nbHitsUncovered"><a title="Line 622: Conditional coverage 0% (0/2).">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 622: Conditional coverage 0% (0/2).">        <span class="keyword">if</span> (entityURL.startsWith(<span class="string">"/"</span>)) {</a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;623</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// http client can only deal in complete URLs - e.g. "http://localhost:8080/thing"</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;624</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            String serverName = req.getServerName();</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;625</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">int</span> serverPort = req.getServerPort();</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;626</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            String protocol = req.getScheme();</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;627</td>  <td class="nbHitsUncovered"><a title="Line 627: Conditional coverage 0% (0/4) [each condition: 0%, 0%].">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 627: Conditional coverage 0% (0/4) [each condition: 0%, 0%].">            <span class="keyword">if</span> (protocol == <span class="keyword">null</span> || <span class="string">""</span>.equals(protocol)) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;628</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                protocol = <span class="string">"http"</span>;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;629</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;630</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            StringBuilder sb = <span class="keyword">new</span> StringBuilder(); <span class="comment">// the server URL</span></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;631</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            sb.append(protocol);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;632</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            sb.append(<span class="string">"://"</span>);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;633</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            sb.append(serverName);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;634</td>  <td class="nbHitsUncovered"><a title="Line 634: Conditional coverage 0% (0/2).">&nbsp;0</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 634: Conditional coverage 0% (0/2).">            <span class="keyword">if</span> (serverPort &gt; 0) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;635</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                sb.append(<span class="string">":"</span>);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;636</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                sb.append(serverPort);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;637</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;638</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// look up the server URL using a service?</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;639</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            entityURL = sb.toString() + entityURL;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;640</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;641</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        <span class="keyword">return</span> entityURL;</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;642</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;643</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;644</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;645</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Gets the refs (batch URLs to handle) from the request if possible</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;646</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param req the request</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;647</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @return the array of references</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;648</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @throws IllegalArgumentException if the refs canot be found</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;649</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;650</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> String[] getRefsOrFail(HttpServletRequest req) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;651</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        String[] refs = req.getParameterValues(REFS_PARAM_NAME);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;652</td>  <td class="nbHitsUncovered"><a title="Line 652: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 652: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">        <span class="keyword">if</span> (refs == <span class="keyword">null</span> || refs.length == 0) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;653</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">throw</span> <span class="keyword">new</span> IllegalArgumentException(REFS_PARAM_NAME + <span class="string">" parameter must be set (e.g. /direct/batch.json?"</span>+REFS_PARAM_NAME+<span class="string">"=/sites/popular,/sites/newest)"</span>);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;654</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;655</td>  <td class="nbHitsUncovered"><a title="Line 655: Conditional coverage 50% (1/2).">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 655: Conditional coverage 50% (1/2).">        <span class="keyword">if</span> (refs.length == 1) {</a></span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;656</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// process separated list, assume comma separated</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;657</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;            String separator = req.getParameter(<span class="string">"separator"</span>);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;658</td>  <td class="nbHitsUncovered"><a title="Line 658: Conditional coverage 25% (1/4) [each condition: 50%, 0%].">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 658: Conditional coverage 25% (1/4) [each condition: 50%, 0%].">            <span class="keyword">if</span> (separator == <span class="keyword">null</span> || <span class="string">""</span>.equals(separator)) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;659</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;                separator = <span class="string">","</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;660</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;661</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;            String presplit = refs[0];</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;662</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;            refs = presplit.split(separator);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;663</td>  <td class="nbHitsUncovered"><a title="Line 663: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 663: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">            <span class="keyword">if</span> (refs == <span class="keyword">null</span> || refs.length == 0) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;664</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;                <span class="keyword">throw</span> <span class="keyword">new</span> IllegalStateException(<span class="string">"Failure attempting to process the _refs ("</span>+presplit+<span class="string">") listing, could not get the final list of refs out by splitting using the separator ("</span>+separator+<span class="string">")"</span>);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;665</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;666</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;667</td>  <td class="nbHitsUncovered"><a title="Line 667: Conditional coverage 50% (1/2).">&nbsp;12</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 667: Conditional coverage 50% (1/2).">        <span class="keyword">if</span> (refs.length &lt;= 0) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;668</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">throw</span> <span class="keyword">new</span> IllegalArgumentException(REFS_PARAM_NAME + <span class="string">" parameter must be set and there must be at least 1 reference (e.g. /direct/batch.json?"</span>+REFS_PARAM_NAME+<span class="string">"=/sites/popular,/sites/newest)"</span>);</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;669</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;670</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">return</span> refs;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;671</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;672</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;673</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;674</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Takes the overall data and reintegrates any content data that is waiting to be merged,</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;675</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * this may do nothing if there is no content to merge</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;676</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @return the integrated data content</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;677</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;678</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> String reintegrateDataContent(String format, HashMap&lt;String, String&gt; dataMap,</pre></td></tr>
<tr>  <td class="numLine">&nbsp;679</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            String overallData) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;680</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        StringBuilder sb = <span class="keyword">new</span> StringBuilder();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;681</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">int</span> curLoc = 0;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;682</td>  <td class="nbHitsCovered"><a title="Line 682: Conditional coverage 100% (2/2).">&nbsp;12</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 682: Conditional coverage 100% (2/2).">        <span class="keyword">for</span> (Entry&lt;String, String&gt; entry : dataMap.entrySet()) {</a></pre></td></tr>
<tr>  <td class="numLine">&nbsp;683</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            <span class="comment">// looping order is critical here, it must be in the same order it was added</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;684</td>  <td class="nbHitsUncovered"><a title="Line 684: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">&nbsp;16</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 684: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">            <span class="keyword">if</span> (entry.getKey() != <span class="keyword">null</span> &amp;&amp; ! <span class="string">""</span>.equals(entry.getKey())) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;685</td>  <td class="nbHitsCovered">&nbsp;16</td>  <td class="src"><pre class="src">&nbsp;                String key = entry.getKey();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;686</td>  <td class="nbHitsCovered">&nbsp;16</td>  <td class="src"><pre class="src">&nbsp;                String value = entry.getValue();</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;687</td>  <td class="nbHitsCovered"><a title="Line 687: Conditional coverage 100% (2/2).">&nbsp;16</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 687: Conditional coverage 100% (2/2).">                <span class="keyword">if</span> (Formats.XML.equals(format)) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;688</td>  <td class="nbHitsCovered">&nbsp;7</td>  <td class="src"><pre class="src">&nbsp;                    value = <span class="string">"\n"</span> + value; <span class="comment">// add in a break</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;689</td>  <td class="nbHitsUncovered"><a title="Line 689: Conditional coverage 50% (1/2).">&nbsp;9</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 689: Conditional coverage 50% (1/2).">                } <span class="keyword">else</span> <span class="keyword">if</span> (Formats.JSON.equals(format)) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;690</td>  <td class="nbHitsCovered">&nbsp;9</td>  <td class="src"><pre class="src">&nbsp;                    key = <span class="string">'"'</span> + key + <span class="string">'"'</span>; <span class="comment">// have to also replace the quotes</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;691</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;692</td>  <td class="nbHitsCovered">&nbsp;16</td>  <td class="src"><pre class="src">&nbsp;                <span class="keyword">int</span> keyLoc = overallData.indexOf(key);</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;693</td>  <td class="nbHitsUncovered"><a title="Line 693: Conditional coverage 50% (1/2).">&nbsp;16</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 693: Conditional coverage 50% (1/2).">                <span class="keyword">if</span> (keyLoc &gt; -1) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;694</td>  <td class="nbHitsCovered">&nbsp;16</td>  <td class="src"><pre class="src">&nbsp;                    sb.append( overallData.subSequence(curLoc, keyLoc) );</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;695</td>  <td class="nbHitsCovered">&nbsp;16</td>  <td class="src"><pre class="src">&nbsp;                    sb.append( value );</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;696</td>  <td class="nbHitsCovered">&nbsp;16</td>  <td class="src"><pre class="src">&nbsp;                    curLoc = keyLoc + key.length();</pre></td></tr>
<tr>  <td class="numLine">&nbsp;697</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;698</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                <span class="comment">//overallData = overallData.replace(key, value);</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;699</td>  <td class="nbHitsCovered">&nbsp;16</td>  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;700</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;701</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">// add in the remainder of the overall data string</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;702</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        sb.append( overallData.subSequence(curLoc, overallData.length()) );</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;703</td>  <td class="nbHitsCovered">&nbsp;12</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">return</span> sb.toString();</pre></td></tr>
<tr>  <td class="numLine">&nbsp;704</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;705</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;706</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;707</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Checks that the content is in the correct format and is not too large,</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;708</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * if it is too large it will not be processed and if it is in the wrong format it will be encoded as a data chunk,</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;709</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * it is OK it will be placed into the dataMap and reintegrated after encoding</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;710</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @param content this it the content of the response body (if null then no processing occurs, null returned)</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;711</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * @return the dataKey which maps to the real content, need replace the key later</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;712</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;713</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">private</span> String checkContent(String format, String content, String refKey,</pre></td></tr>
<tr>  <td class="numLine">&nbsp;714</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            HashMap&lt;String, String&gt; dataMap) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;715</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;        String dataKey = <span class="keyword">null</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;716</td>  <td class="nbHitsUncovered"><a title="Line 716: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">&nbsp;19</a></td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;<a title="Line 716: Conditional coverage 50% (2/4) [each condition: 50%, 50%].">        <span class="keyword">if</span> ( content != <span class="keyword">null</span> &amp;&amp; ! <span class="string">""</span>.equals(content.trim()) ) {</a></span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;717</td>  <td class="nbHitsCovered"><a title="Line 717: Conditional coverage 100% (2/2).">&nbsp;19</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 717: Conditional coverage 100% (2/2).">            <span class="keyword">if</span> (entityEncodingManager.validateFormat(content, format)) {</a></pre></td></tr>
<tr>  <td class="numLine">&nbsp;718</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;                <span class="comment">// valid for the current format so insert later instead of merging now</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;719</td>  <td class="nbHitsCovered">&nbsp;16</td>  <td class="src"><pre class="src">&nbsp;                dataKey = UNIQUE_DATA_PREFIX + refKey;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;720</td>  <td class="nbHitsCovered">&nbsp;16</td>  <td class="src"><pre class="src">&nbsp;                dataMap.put(dataKey, content);</pre></td></tr>
<tr>  <td class="numLine">&nbsp;721</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;722</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;723</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">return</span> dataKey;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;724</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;725</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;726</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;727</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Base class for all response data which will be encoded and output</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;728</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;729</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class</span> ResponseBase {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;730</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> String reference;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;731</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> String getReference() {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;732</td>  <td class="nbHitsCovered">&nbsp;40</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">return</span> reference;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;733</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;734</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> String entityURL;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;735</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> String getEntityURL() {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;736</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">return</span> entityURL;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;737</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;738</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> <span class="keyword">int</span> status;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;739</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> <span class="keyword">int</span> getStatus() {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;740</td>  <td class="nbHitsCovered">&nbsp;38</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">return</span> status;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;741</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;742</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> <span class="keyword">transient</span> <span class="keyword">boolean</span> failure = <span class="keyword">false</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;743</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> <span class="keyword">boolean</span> isFailure() {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;744</td>  <td class="nbHitsCovered">&nbsp;20</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">return</span> failure;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;745</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;746</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;747</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;748</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;749</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Holds the error values which will be encoded by the various EB utils</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;750</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;751</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class</span> ResponseError <span class="keyword">extends</span> ResponseBase {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;752</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> String error;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;753</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> ResponseError(String reference, String entityURL, String errorMessage) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;754</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.reference = reference;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;755</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.entityURL = entityURL;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;756</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.error = errorMessage;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;757</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.failure = <span class="keyword">true</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;758</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;759</td>  <td class="nbHitsCovered">&nbsp;1</td>  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;760</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;761</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;762</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;763</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     * Holds the results from a successful response request</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;764</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">     */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;765</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class</span> ResponseResult <span class="keyword">extends</span> ResponseBase {</pre></td></tr>
<tr>  <td class="numLine">&nbsp;766</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> Map&lt;String, String[]&gt; headers;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;767</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> String data;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;768</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;769</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * Set the data key (clears the raw content) if the key is non-null</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;770</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * @param data processed data</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;771</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;772</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> <span class="keyword">void</span> setDataKey(String dataKey) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;773</td>  <td class="nbHitsCovered"><a title="Line 773: Conditional coverage 100% (2/2).">&nbsp;19</a></td>  <td class="src"><pre class="src">&nbsp;<a title="Line 773: Conditional coverage 100% (2/2).">            <span class="keyword">if</span> (dataKey != <span class="keyword">null</span>) {</a></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;774</td>  <td class="nbHitsCovered">&nbsp;16</td>  <td class="src"><pre class="src">&nbsp;                <span class="keyword">this</span>.data = dataKey;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;775</td>  <td class="nbHitsCovered">&nbsp;16</td>  <td class="src"><pre class="src">&nbsp;                <span class="keyword">this</span>.content = <span class="keyword">null</span>;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;776</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;            }</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;777</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;778</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="comment">/**</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;779</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         * The raw content from the request</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;780</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;<span class="comment">         */</span></pre></td></tr>
<tr>  <td class="numLine">&nbsp;781</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> String content;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;782</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        <span class="keyword">public</span> ResponseResult(String reference, String entityURL, <span class="keyword">int</span> status, Map&lt;String, String[]&gt; headers) {</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;783</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">this</span>.reference = reference;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;784</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">this</span>.entityURL = entityURL;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;785</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">this</span>.status = status;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;786</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">this</span>.headers = headers;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;787</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">this</span>.failure = <span class="keyword">false</span>;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;788</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">this</span>.content = <span class="keyword">null</span>;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;789</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;            <span class="keyword">this</span>.data = <span class="keyword">null</span>;</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;790</td>  <td class="nbHitsUncovered">&nbsp;0</td>  <td class="src"><pre class="src"><span class="srcUncovered">&nbsp;        }</span></pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;791</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;        <span class="keyword">public</span> ResponseResult(String reference, String entityURL, <span class="keyword">int</span> status, Map&lt;String, String[]&gt; headers, String content) {</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;792</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.reference = reference;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;793</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.entityURL = entityURL;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;794</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.status = status;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;795</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.headers = headers;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;796</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.content = content;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;797</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.data = <span class="keyword">null</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;798</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;            <span class="keyword">this</span>.failure = <span class="keyword">false</span>;</pre></td></tr>
<tr>  <td class="numLineCover">&nbsp;799</td>  <td class="nbHitsCovered">&nbsp;19</td>  <td class="src"><pre class="src">&nbsp;        }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;800</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;    }</pre></td></tr>
<tr>  <td class="numLine">&nbsp;801</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;</pre></td></tr>
<tr>  <td class="numLine">&nbsp;802</td>  <td class="nbHits">&nbsp;</td>
  <td class="src"><pre class="src">&nbsp;}</pre></td></tr>
</table>

<div class="footer">Report generated by <a href="http://cobertura.sourceforge.net/" target="_top">Cobertura</a> 1.9 on 1/29/09 11:15 AM.</div>
</body>
</html>
